﻿<%@ Page Language="VB" EnableEventValidation="false" MasterPageFile="~/Presentation/MasterPage.master"  AutoEventWireup="false" CodeFile="~/Code/Workflow.aspx.vb" Inherits="Presentation_Workflow" title="Untitled Page" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<%@ Register Assembly="obout_Calendar2_Net" Namespace="OboutInc.Calendar2" TagPrefix="obout"%>

<asp:Content ID="Content1" ContentPlaceHolderID="MainMaster" Runat="Server">
<form runat ="server" id="Form1">
    &nbsp;
    <table border="0" cellpadding="0" cellspacing="0" style="width: 1000px; table-layout: auto; white-space: nowrap; height: 100%;">
        <!-- MSTableType="layout" -->
		<tr style="background-color: #eff3fb;">
            <td>
    Please type in Part of the Company's Name:</td>
            <td>
                <asp:ScriptManager id="ScriptManager1" runat="server">
                </asp:ScriptManager> 
                <asp:UpdatePanel id="UpdatePanel1" runat="server">
                    <ContentTemplate>
                
    <asp:TextBox ID="txtSearchName" runat="server" AutoPostBack = "true" Width="183px"></asp:TextBox>
                    </ContentTemplate>
                </asp:UpdatePanel>
                
    </td>
            <td style="height: 100%"></td>
		</tr>
		<tr>
            <td>
                    Please Select your company from the list:</td>
            <td>
    
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:DropDownList ID="dlClientNames"  DataTextField = "ClientName" DataValueField = "ClientID" runat="server">
                        </asp:DropDownList>
                    </ContentTemplate>
                </asp:UpdatePanel>
                            <asp:RequiredFieldValidator ID="rvddlClientNames" ControlToValidate = "dlClientNames"
                             InitialValue = "0" runat="server" ErrorMessage="Select a Client" 
                             SetFocusOnError ="true" BorderColor="Transparent" Width="116px"></asp:RequiredFieldValidator>(If you don't see your company here, please <a href="CreateCompany.aspx">enter a new company</a>)</td>
            <td>&nbsp;</td>
		</tr>
		<tr style="background-color: #eff3fb">
            <td>
                    Please Select your Project:</td>
            <td>
                <asp:DropDownList ID="dlProjectNames" runat="server" DataTextField="ProjectName" DataValueField="ProjectID" ToolTip="If you do not see your project here, or the project box is empty, please contact Bhagwad at bhagwad@zakgroup.com">
    </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rvddlProjectNames"
                            ControlToValidate = "dlProjectNames" 
                            InitialValue = "0" runat="server" ErrorMessage="Please Select Your Project" 
                            SetFocusOnError ="true" Height="12px"></asp:RequiredFieldValidator></td>
            <td style="height: 26px">&nbsp;</td>
		</tr>
		<tr>
            <td>
    Action Taken:</td>
            <td>
                <asp:DropDownList ID="dlActionTaken" runat="server">
    </asp:DropDownList></td>
            <td style="height: 22px"></td>
		</tr>
		<tr style="background-color: #eff3fb">
            <td>
                Select the Mode of Travel:</td>
            <td>
                <asp:DropDownList ID="dlTravelMode" runat="server">
                </asp:DropDownList></td>
            <td style="height: 22px"></td>
		</tr>
		<tr>
            <td>
                Select the Kms. Travelled:</td>
            <td>
                <asp:TextBox ID="txtKmsTravelled" runat="server" MaxLength="3"></asp:TextBox><asp:RegularExpressionValidator ControlToValidate="txtKmsTravelled" 
    ValidationExpression="[0-9]{0,3}" ID="vdtxtKmsTravelled" runat="server" 
    EnableClientScript ="false"
    SetFocusOnError ="true" ErrorMessage="Enter a value between 1-999" Width="175px"></asp:RegularExpressionValidator><asp:CustomValidator ID="cvdtxtKmsTravelled" ControlToValidate="txtKmsTravelled"
                             runat="server" ValidateEmptyText = "true"
                              OnServerValidate = "ValidateKms" SetFocusOnError ="true" ErrorMessage="This field is compulsory" Width="171px"></asp:CustomValidator></td>
            <td style="height: 26px">&nbsp;</td>
		</tr>
		<tr style="background-color: #eff3fb">
            <td>
    Details of what happened:</td>
            <td>
                <asp:TextBox ID="txtDetails" TextMode ="MultiLine" runat="server" Height="80px" Width="336px"></asp:TextBox><asp:RequiredFieldValidator ID="rvdtxtDetails" SetFocusOnError ="true" ControlToValidate="txtDetails" runat="server" ErrorMessage="This field is required" Width="126px"></asp:RequiredFieldValidator></td>
            <td style="height: 84px">&nbsp;</td>
		</tr>
		<tr>
            <td>
    What is the Status of the Client?</td>
            <td>
    <asp:DropDownList ID="dlStatus" runat="server" ToolTip="Hot:Will Confirm Warm:Intersted Cold:Not Interested Prospective:Negotiating">
    </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rvddlStatus"
                            ControlToValidate = "dlStatus"  runat="server" 
                            InitialValue = "0"
                            ErrorMessage="Please Select a Status" SetFocusOnError="true" ></asp:RequiredFieldValidator>&nbsp;
            </td>
            <td style="height: 26px">&nbsp;</td>
		</tr>
		<tr style="background-color: #eff3fb">
            <td>
                    Next Action:</td>
            <td>
    <asp:TextBox ID="txtNextAction" runat="server" Height="83px" TextMode="MultiLine" Width="336px" ToolTip="Enter what you're going to do next"></asp:TextBox><asp:RequiredFieldValidator ID="rvdtxtNextAction" runat="server" 
                            ControlToValidate = "txtNextAction" SetFocusOnError ="true"
                             ErrorMessage="This field is neccessary" Width="143px"></asp:RequiredFieldValidator></td>
            <td style="height: 87px">&nbsp;</td>
		</tr>
		<tr>
            <td>
                Pick your Date of Next Action<obout:calendar id="CalendarPick" runat="server" datepickerimagetooltip="Click to Select Date of Next Action" datepickermode="True" textboxid="txtDateofNextAction" yearmonthformat="MMMM, yyyy" datepickerimagepath="~/Pictures/Calendar.gif" AllowSelectSpecial="False" Columns="1" StyleFolder="~/Calendar Styles/orbitz/" DateFormat="dd/MM/yyyy" EnabledDateExpression="currentDate.getDay()!=0">
        
    </obout:calendar></td>
            <td>
                    <asp:TextBox ID="txtDateofNextAction" runat="server" MaxLength="10" ToolTip="dd/mm/yyyy format. Eg: 01/01/2007"></asp:TextBox><asp:RequiredFieldValidator ID="rvdtxtDateofNextAction" 
                            ControlToValidate="txtDateofNextAction"
                             SetFocusOnError ="true" runat="server" ErrorMessage="Please enter the Date" Width="140px"></asp:RequiredFieldValidator>
					<br />
                <asp:RegularExpressionValidator ID="vdtxtDateofNextAction" 
                ControlToValidate="txtDateofNextAction"
                 SetFocusOnError ="true" runat="server" ErrorMessage="Please Enter a Date in dd/mm/yyyy format"
                 ValidationExpression="^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$" Width="260px"></asp:RegularExpressionValidator></td>
            <td style="height: 63px">&nbsp;</td>
		</tr>
		<tr>
            <td style="width: 266px">
            </td>
            <td style="width: 726px">
                            <asp:CustomValidator ID="cvdtxtDateofNextAction" runat="server" 
                             ControlToValidate = "txtDateofNextAction"
                              OnServerValidate  = "cvdtxtDateofNextAction_ServerValidate"
                              ClientValidationFunction="ClientValidate" SetFocusOnError ="true" ErrorMessage="Error in Date"
                               Width="456px"></asp:CustomValidator></td>
            <td style="height: 19px"></td>
		</tr>
		<tr>
            <td colspan="2">
    <asp:Button ID="Button1" runat="server" Text="Submit" /></td>
            <td style="height: 26px">&nbsp;</td>
		</tr>
		<tr>
            <td colspan="2" style="height: 19px">
                            <asp:Label ID="Success" Visible="false"  runat="server" Font-Bold="True" Text="Successfully Saved"
                                Width="144px"></asp:Label></td>
            <td style="height: 19px; width: 8px"></td>
		</tr>
    </table>
</form>

<script type="text/javascript" language="javascript">
 
<!--
        
        function ClientValidate(source, arguments)
        {
            var datearray = arguments.Value.split("/");
               
            day = datearray[0];
    	    month = datearray[1];
    	    year = datearray[2];
    	    
    	    if (day < 1 || day > 31)
    	    {
    		    source.innerHTML = "Day must be between 1 and 31";		    
    		    arguments.IsValid = false;
            }
        
            if (month < 1 || month > 12)
    	    {
    		//alert("Month must be between 1 and 12");
    		source.innerHTML = "Month must be between 1 and 12";		    
        	arguments.IsValid = false;
            }
        
            if ((month==4 || month==6 || month==9 || month==11) && day==31) {
			//alert("Month "+month+" doesn't have 31 days!");
			source.innerHTML = "Month "+month+" doesn't have 31 days!"
			arguments.IsValid = false;
		
		    }
		
		    if (month == 2) 
		    { // check for february 29th
			    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			    if (day>29 || (day==29 && !isleap)) 
			    {
			        //alert("February " + year + " doesn't have " + day + " days!");
			        source.innerHTML = "February " + year + " doesn't have " + day + " days!";
			        arguments.IsValid = false;
   			    }
               
        
             }
           
          }
    
//-->
</script>

 </asp:Content>

